<template>
	<view class="containers">

		<view class="main-app">
			<view class="header">

				<topWallet :getName="names" :isLogins="islogin"></topWallet>

			</view>
			<view class="main-content zh">
				<view class="m-0 row">
					<view class="col-12 col wallet-box">
						<view class="profile-main-account v0 card">
							<h4>{{$t('Total_global_finance')}}</h4>
							<view class="user-info-panel">
								<view class="m-0 row">
									<view class="col-12 col">
										<view
											style="line-height: 10px; margin-bottom: 15px; display: grid; text-align: center;">
											<label>USDT</label><span>{{lineUpSums}}</span>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view class="col-12 pt-3 col">
						<view>
							<view class="m-0 row">
								<view class="col-12 col">
									<p class="text-gold bold">{{$t('Common-row-specification')}}</p>
								</view>
								<view class="col-12 p-0 col">
									<view class="activate-package" style="padding: 0.5em 0.3em;">
										<view class="m-0 row">
											<view style="border-color: rgb(193, 209, 255);"
												class="d-flex justify-content-left p-0">
												<view style="margin-bottom: 0px; line-height: 12px;">
													<view
														style="color:rgb(193, 209, 255); font-size: 22rpx; opacity: 0.9;line-height: 34rpx;margin-left:0rpx">
														{{$t('common_unit_of_calculation')}}
													</view>

													<view
														style="color: rgb(193, 209, 255); font-size: 22rpx; opacity: 0.9;line-height: 34rpx;margin-left:0rpx">
														{{$t('purchased_for_financial_planning')}}
													</view>

													<view
														style="color:rgb(193, 209, 255); font-size: 22rpx; opacity: 0.9;line-height: 34rpx;margin-left:0rpx">
														{{$t('returns_the_cost_immediately')}}
													</view>
													<view
														style="color:rgb(193, 209, 255); font-size: 22rpx; opacity: 0.9;line-height: 34rpx;margin-left:0rpx">
														{{$t('without_continued_reinvestment')}}
													</view>

												</view>
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
					<view class="col-12 pt-3 col">

						<view>
							<!-- <view class="m-0 row">
								<view class="col-12 col">
									<p class="text-gold bold">{{$t('Common_row_record')}}</p>
								</view>
							</view> -->
							<!-- <view class="col-12 p-0 col"> -->
							<view style="margin-bottom: 10rpx;">
								<u-subsection :isHistory="true" :list="list" :current="curNow" @change="sectionChange"
									activeColor="#f1c594" bgColor="#00000000" inactiveColor="#fff"></u-subsection>
							</view>
							<!-- </view> -->

							<view class="m-0 row">

								<view class="col-12 p-0 col">
									<view style="padding: 0.5em 0.3em;" v-for="(item,index) in publicList" :key="index">
										<view class="active-card-package">
											<view class="card-package card">
												<view class="m-0 row">
													<view class="col-3 col-lg-3 col"><label
															class="name text-start">{{$t('Participation_time')}}</label>
													</view>
													<view class="col-6 col"><label
															class="price justify-content-center">{{item['create_time']}}</label>
													</view>
													<view class="col-3 col-lg-3 d-flex align-items-center gap-2 col">
														<button type="button"
															class="package-button btn btn-primary"><label>{{publicType[item['status']]['name']}}</label></button>
													</view>
												</view>
											</view>
										</view>
									</view>
									<view class="uni-pagination-box" v-if="publicList.length>0"
										style="margin-top: 20rpx;">
										<UniPagination :page-size="pageSize" :current="pageIndex" :total="total"
											@change="change" />
									</view>
								</view>

							</view>
							<!-- 	<view class="card-package " style="margin-top: 20rpx;">
								<uni-table ref="table" :loading="loading" border type="table"
									:emptyText="No_further_data_available" @selection-change="selectionChange">
									<uni-tr>
										<uni-th width="100" align="center">{{$t('Participation_time')}}</uni-th>
										<uni-th width="100" align="center">{{$t('Out_or_not')}}</uni-th>

									</uni-tr>
									<uni-tr v-for="(item, index) in publicList" :key="index">

										<uni-td>
											<view class="name">{{ item.create_time }}</view>
										</uni-td>
										<uni-td align="center">{{publicType[item['status']]['name']}}</uni-td>
									</uni-tr>
								</uni-table>
								<view class="uni-pagination-box">
									<UniPagination :page-size="pageSize" :current="pageIndex" :total="total"
										@change="change" />
								</view>
							</view> -->
						</view>

					</view>

				</view>
			</view>
		</view>
		<view v-if="publicList.length==0">
			<view class="listing-container">
				<view class="d-flex justify-content-center  row">
					<view class="     d-grid"><span class="text-center text-empty pt-3">{{$t('No_record')}}</span>
					</view>
				</view>
			</view>
		</view>
		<!-- <u-loadmore :loadmoreText="loadText" marginBottom="40" fontSize="12" color="rgba(193, 209, 255, .4)"
			lineColor="rgba(193, 209, 255, .4)" /> -->
	</view>
</template>
<script>
	import topWallet from "@/components/nav/top_wallet.vue"
	import UniPagination from "@/components/UniPagination.vue"
	export default {
		components: {
			topWallet,
			UniPagination
		},
		data() {
			return {
				list: [
					this.$t('Not_out_record'),
					this.$t('Outgoing_record'),
				],
				No_further_data_available: this.$t('No_further_data_available'),
				curNow: 0,
				loadText: '',
				loadn: false,
				select: 1,
				lineUpSums: 0,
				lineOut: 0,
				lineIn: 0,
				publicList: [],
				publicType: [{
						name: this.$t('Not_out')
					},
					{
						name: this.$t('Out')
					}
				],
				islogin:false,
				names:this.$t('login'),
				// 当前页
				pageIndex: 1,
				pageSize: 14,
				total: 0,
				loading: false

			};
		},
		onLoad: function() {

		},

		onShow() {
			this.tui.haslogin();
			if (this.tui.isLogin()) {
				this.islogin = true;
				this.names = this.tui.hidden(uni.getStorageSync("yy_wallet").address, 3, 4)
				this.init()
			}
		},
		methods: {
			showTips: function(msg, type) {

				let options = {
					msg: msg,
					duration: 2000,
					type: 'default'
				};
				this.$refs.toast.showTips(options);
			},
			init() {
				let datas = {
					page: this.pageIndex,
					status: this.curNow
				};
				this.loading = true
				let result = this.tui.request('/api/user/getLineUpData', 'post', datas, 1000, 1, '', 'getLineUpData');
				Promise.resolve(result).then((value) => {
					this.loading = false
					if (value.code == 200) {

						this.lineUpSums = value.data.lineOut + value.data.lineIn;
						this.publicList = value.data.data
						this.total = value.data.total_count
						//                   this.list[0]=this.list[0]+value.data.lineIn;
						// this.list[1]=this.list[1]+value.data.lineOut;
						// if (this.pageIndex == 1) {
						// 	this.publicList = value.data.data
						// 	this.total = value.data.total_count
						// 	if (this.publicList.length < 14) {
						// 		this.loadn = true
						// 		this.loadText = this.$t('Have_end')
						// 	} else {
						// 		this.pageIndex++
						// 		this.loadText = this.$t('load_more')
						// 	}
						// }

						//  else {
						// 	this.publicList = this.publicList.concat(value.data.data)
						// 	if (value.data.data.length < 14) {
						// 		this.loadn = true
						// 		this.loadText = this.$t('Have_end')
						// 	} else {
						// 		this.pageIndex++
						// 		this.loadText = this.$t('load_more')
						// 	}
						// }
					}
				})

			},
			// 分页触发
			change(e) {
				// this.$refs.table.clearSelection()
				this.pageIndex = e.current
				this.init(e.current)
			},
			sectionChange(index) {
				this.curNow = index
				this.loadn = false
				this.pageIndex = 1
				this.publicList = []
				switch (index) {
					case 0:


						break
					case 1:

						break


				}
				this.init();
			},
			langPop() {
				this.isopen = true
			},
			closeOpen() {
				this.isopen = false
				this.open_reg = false
			},
		},
		onPullDownRefresh() {
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 200)
		},
		onReachBottom: function() {
			if (this.loadn) {
				return
			}
			// this.init()
		},

	};
</script>
<style lang="scss">
	@import '../../static/css/defalut.css';

	page {
		background-color: #252C46;
		min-height: 100%;
	}

	.main-app {
		overflow-y: auto;
	}

	.containers {
		// background: url(../../static/images/common/bg.jpg) #000 top no-repeat;

		background-size: 100%;
		margin: 0 !important;
		// -webkit-filter: brightness(70%);
		// filter: brightness(90%);
		width: 100%;
		min-height: 100vh;

	}
</style>